package com.example.demo.confi;

import com.alibaba.fastjson.JSONObject;
import com.example.demo.others.jenkins.DownFile;
import com.example.demo.others.jenkins.Jenkins;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017-6-9.
 */
@Controller
@RequestMapping
public class JenkinsConf {



    Logger logger = LoggerFactory.getLogger(JenkinsConf.class);

    public static List<JSONObject> list = new ArrayList<>();

    static {

        Mo trade = Mo.create("trade", "trade-web", "trade-web.war", null, "trade-web-v3-deploy(git)", "true");
        Mo provider = Mo.create("service-provider.jar", "service-provider", "service-provider.jar", "service-provider", "service-provider-v3-deploy(git)", "");
        Mo api = Mo.create_pub("api", "service-api", "service-api.jar", "service-api");
        Mo ticket = Mo.create("ticket", "service-ticket", "service-ticket.jar", "service-ticket", "service-ticket-v3-deploy(git)", "");
        Mo ticket_query = Mo.create("query", "service-ticket-query", "service-ticket-query.jar", "service-ticket-query", "service-query-v3-deploy-git", "");
        Mo bypay = Mo.create("bypay", "service-bypay", "service-bypay.jar", "service-bypay", "service-bypay-v3-deploy(git)", "");
        Mo fast = Mo.create("fastLotteryCrawl", "fastLotteryCrawl", "fastLotteryCrawl.jar", "", "fastLotteryCrawl-deploy-v3(git)", "true");
        Mo info = Mo.create("info", "service-info", "service-info-0.0.1-SNAPSHOT.jar", "service-info", "service-info-deploy(git)", "true");
        Mo push = Mo.create("push", "service-push", "service-push.jar", "", "service-push-v3-deploy(git)", "true");
        Mo apimanager = Mo.create("api", "api-manage", "api-manage-0.0.1-SNAPSHOT.jar", "", "api-manage-v3-deploy(git)", "true");
        Mo task = Mo.create("task", "service-task", "service-task-0.0.1-SNAPSHOT.jar", "", "service-task-v3-deploy(git)", "true");
        Mo job = Mo.create("job", "service-job", "service-job.war", "", "service-job-v3-deploy(git)", "true");
        Mo auth = Mo.create("auth", "auth-web", "auth-web.war", "", "auth-web-v3-deploy(git)", "true");

        task.ip("103");
        info.ip("101 102");


        list.add(apimanager);
        list.add(api);
        list.add(provider);

        list.add(trade);
        list.add(auth);
        list.add(task);
        list.add(job);
        list.add(info);
        list.add(ticket);
        list.add(ticket_query);
        list.add(push);
        list.add(bypay);
        list.add(fast);


    }



   public static List<JSONObject> models = new ArrayList<>();

    static {

        models.add(create(DownFile.apimanage, "build-api-manage", ""));
        models.add(create(DownFile.fastLotteryCrawl, "build-fastLotteryCrawl", "fastLotteryCrawl"));
        models.add(create(DownFile.info, "build-info", "service-info"));
        models.add(create(DownFile.job, "build-service-job", ""));
        models.add(create(DownFile.push, "build-service-push", ""));
        models.add(create(DownFile.task, "build-task-v3", "service-task"));
        models.add(create(DownFile.ticket, "build-service", "service-ticket"));
        models.add(create(DownFile.ticket_query, "build-service", "service-ticket-query"));
        models.add(create(DownFile.tradeweb, "build-trade-web", "trade-web"));
        models.add(create(DownFile.api, "build-service", "service-api"));
        models.add(create(DownFile.provider, "build-service", "service-provider"));
        models.add(create(DownFile.bypay, "build-service", "service-bypay"));
        models.add(create(DownFile.auth, "build-auth-web", "auth-web"));


    }

    private static JSONObject create(String pack, String model, String download) {
        JSONObject j = new JSONObject();
        j.put("pack", pack);
        j.put("model", model);
        j.put("download", download);
        return j;
    }



}
